package com.boot.notes;

import org.springframework.context.ApplicationContext;
import org.springframework.context.expression.BeanFactoryResolver;
import org.springframework.core.MethodParameter;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;

/**
 * @BelongsProject: springboot
 * @BelongsPackage: com.boot.notes
 * @Author: meikaiqiang
 * @CreateTime: 2022-08-09  08:55
 * @Description: TODO
 * @Version: 1.0
 */
public class Mytest {

    private static final ExpressionParser SPEL_PARSER = new SpelExpressionParser();

    private ApplicationContext applicationContext;

    public static void main(String[] args) {
        Expression expression = SPEL_PARSER.parseExpression("hasPermission('aaa')");
        StandardEvaluationContext context = new StandardEvaluationContext(new AuthMy());

        Boolean value = expression.getValue(context, Boolean.class);
        System.out.println(value);
    }
}
